wrapText

Calculate text to fit within a box, and optionally wrap the text into several lines.

wrapText(textProperties: IFontStyle, text: string, maxWidth: number): string[]

Arguments

textProperties: IFontStyle

  • The text properties for which to calculate the width.

text: string

  • The text for which to calculate the width.

maxWidth: number

  • The maximum available width for the text.

Returns

string

  • An array containing the original text divided into several lines.
  • Each line text width is no longer than the maxWidth value.